<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8"><title>效果</title>
		<script type="text/javascript" src="js/jquery-3.3.1.js" ></script>
		<style>
			div{
				background: lightblue;
				padding: 20px;
			}
			p{
				background: lavenderblush;
				padding: 20px;
			}
		</style>
		<script>
			$(function(){
				$("#btnIn").click(function(){
					//$("div").fadeIn();
					//$("div").fadeIn(2000);
					$("div").fadeIn(2000,function(){
						alert("淡入完成！");
					});
				});
				
				$("#btnOut").click(function(){
					//$("div").fadeOut();
					//$("div").fadeOut(2000);
					$("div").fadeOut(2000,function(){
						alert("淡出完成！");
					});
				});
				$("#btnToggle").click(function(){
					//$("p").fadeToggle();
					//$("p").fadeToggle(2000);
					$("p").fadeToggle(2000,function(){
						alert("切换完成！");
					});
				});
			});
		</script>
	</head>
<body>
	<button id="btnIn">淡入-div</button>
	<button id="btnOut">淡出-div</button>
	<button id="btnToggle">切换淡入淡出-P</button>
	<div>div1</div>
	<br/>
	<div>div2</div>
	<p style="display: none;">p1</p>
	<p>p2</p>
</body>
</html>